package com.meaningful.thinking.schedule_demo;

/**
 * 具体执行的任务的包装
 */
public class Job implements Comparable<Job> {

    // 做什么
    private Runnable task;

    // 什么时候做
    private long startTime;

    // 间隔、用于计算下一次开始时间
    private long delay;

    public long getDelay() {
        return delay;
    }

    public void setDelay(long delay) {
        this.delay = delay;
    }

    public Runnable getTask() {
        return task;
    }

    public void setTask(Runnable task) {
        this.task = task;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    @Override
    public int compareTo(Job otherJob) {
        return Long.compare(this.startTime, otherJob.startTime);
    }

}
